1 /** 2 A module with tests to test the compile-time reflection 3 */ 4 5 module unit_threaded.ut.modules.parametrized; 6 7 import unit_threaded.attrs; 8 9 version (unittest) { 10 11 @(1, 2, 3) 12 @AutoTags void testValues(int i) { 13 assert(i % 2 != 0); 14 } 15 16 @Types!(float, int) @AutoTags void testTypes(T)() { 17 assert(T.init == 0); 18 } 19 } 20 21 @("builtinIntValues") 22 @AutoTags @Values(2, 3, 4, 5) 23 unittest { 24 import std.conv; 25 26 immutable i = getValue!int; 27 assert(i == 3); 28 } 29 30 @("cartesianBuiltinNoAutoTags") 31 @Values("foo", "bar") 32 @Values("red", "blue", "green") 33 unittest { 34 assert(getValue!(string, 0).length == getValue!(string, 1).length); 35 } 36 37 @("cartesianBuiltinAutoTags") 38 @Values("foo", "bar") 39 @Values("red", "blue", "green") 40 @AutoTags unittest { 41 assert(getValue!(string, 0).length == getValue!(string, 1).length); 42 } 43 44 @(1, 2, 3) 45 @("foo", "bar") 46 @AutoTags testCartesianFunction(int i, string s) { 47 assert(i == 2 && s == "bar"); 48 } 49 50 void testIssue31(int, string) { 51 // this used to fail because there are no UDAs on this function 52 }